//2956.找到两个数组中的公共元素
//https://leetcode.cn/problems/find-common-elements-between-two-arrays
class Solution {
public:
    vector<int> findIntersectionValues(vector<int>& nums1, vector<int>& nums2) {
        bitset<256> bs1,bs2;
        int n1 = nums1.size(),n2 = nums2.size();
        for(int i = 0;i<n2;++i) bs2.set(nums2[i]);
        
        int ret1 = 0, ret2 = 0;
        //计算nums1中出现了多少nums2
        for(int i = 0;i<n1;++i) 
        {
            if(bs2[nums1[i]]) ++ret1;
            bs1.set(nums1[i]);
        }
        for(int i = 0;i<n2;++i) if(bs1[nums2[i]]) ++ret2;
        return {ret1,ret2};
    }
};